use super::schema::tasks;
use diesel::prelude::*;

#[derive(Queryable, Identifiable)]
pub struct Task {
    pub id: i32,
    pub title: String,
    pub description: Option<String>,
    pub due_date: Option<chrono::NaiveDateTime>,
    pub priority: String,
    pub status: String,
    pub user_id: i32,
    pub created_at: chrono::NaiveDateTime,
    pub updated_at: chrono::NaiveDateTime,
}

#[derive(Insertable)]
#[table_name = "tasks"]
pub struct NewTask<'a> {
    pub title: &'a str,
    pub description: Option<&'a str>,
    pub due_date: Option<chrono::NaiveDateTime>,
    pub priority: &'a str,
    pub status: &'a str,
    pub user_id: i32,
}
